package org.zs.miracle.common.exception;

import java.io.Serial;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class BaseException extends RuntimeException {
  
  @Serial
  private static final long serialVersionUID = -2879418308051820890L;
  
  private int code;
  
  public BaseException(int code) {
    this.code = code;
  }
  
  public BaseException(String message, int code) {
    super(message);
    this.code = code;
  }
  
  public BaseException(String message, Throwable cause, int code) {
    super(message, cause);
    this.code = code;
  }
  
  public BaseException(Throwable cause, int code) {
    super(cause);
    this.code = code;
  }
  
  public BaseException(String message, Throwable cause, boolean enableSuppression,
      boolean writableStackTrace, int code) {
    super(message, cause, enableSuppression, writableStackTrace);
    this.code = code;
  }
  
  public void setCode(int code) {
    this.code = code;
  }
}